<?php
class Session extends Object
{
    public static function IsExisted($key)
    {
        return isset($_SESSION[$key]);
    }

    public static function Get($key)
    {
        return self::IsExisted($key) ? $_SESSION[$key] : null;
    }

    public static function Set($key, $value)
    {
        $_SESSION[$key] = $value;
    }

    public static function GetSerialize($key)
    {
        return unserialize(self::Get($key));
    }

    public static function SetSerialize($key, $value)
    {
        self::Set($key, serialize($value));
    }

    public static function Remove($key)
    {
        unset($_SESSION[$key]);
    }

    public static function IsTrue($key)
    {
        return true && self::Get($key);
    }

    public static function IsFalse($key)
    {
        return !self::IsTrue($key);
    }

    public static function IsExistedAndFalse($key)
    {
        return self::IsExisted($key) && self::IsFalse($key);
    }

    public static function IsExistedAndTrue($key)
    {
        return self::IsExisted($key) && self::IsTrue($key);
    }

    public static function GetKeys()
    {
        return array_keys($_SESSION);
    }

    public static function GetAll()
    {
        return $_SESSION;
    }

    public static function GetId()
    {
        return session_id();
    }
}
?>
